<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Medicine Stock Management</title>

	<?php echo css_asset('bootstrap.css'); ?>
	<?php echo css_asset('bootstrap-theme.css'); ?>
	<?php echo js_asset('bootstrap.min.js'); ?>
	
	<script src="https://code.jquery.com/jquery.js"></script>

</head>

<body>
<?php echo js_asset('bootstrap.min.js'); ?>

	<div id="header">
		<div class="half left">
			<div id="lside">
				<ul class="nav nav-pills nav-stacked">
					<li height="50"><a href="<?php echo base_url();?>pro_ctrl">
					<b><font color="c9c9c9"><span class="glyphicon glyphicon-user"></span>&nbsp;
					<?php $session_data = $this->session->userdata('logged_in');?>
					<?php echo $session_data['username']; ?></font>
					<span class="navbar-right"><font color="#1ce335">Online&nbsp;
					<span class="glyphicon glyphicon-map-marker"></span></font></span></b></a></li>
					<li class="divider"></li>
				</ul>
			</div>
		</div>

		<div class="half right">
			<nav class="navbar navbar-inverse" role="navigation">
				<!-- Brand and toggle get grouped for better mobile display -->
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse"
						data-target="#bs-example-navbar-collapse-1">
						<span class="sr-only">Toggle navigation</span> <span
							class="icon-bar"></span> <span class="icon-bar"></span> <span
							class="icon-bar"></span>
					</button>
					<a class="navbar-brand">Medicine Stock Management</a>
				</div>

				<!-- Collect the nav links, forms, and other content for toggling -->
				<div class="collapse navbar-collapse"
					id="bs-example-navbar-collapse-1">
					<ul class="nav navbar-nav">

					</ul>
					<!-- <form class="navbar-form navbar-left" role="search">
						<div class="form-group">
							<input type="text" class="form-control" placeholder="Search">
						</div>
						<button type="submit" class="btn btn-default">Submit</button>
					</form> -->
					<ul class="nav navbar-nav navbar-right">
						<li class="dropdown"><a href="#"
							class="dropdown-toggle glyphicon glyphicon-list"
							data-toggle="dropdown"> <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li><a href="<?php echo base_url();?>sale_ctrl">Sale Page</a></li>
								<li><a href="<?php echo base_url();?>pro_ctrl">Profile</a></li>
								<li class="divider"></li>
								<li><a href="<?php echo base_url();?>login_control/logout">Logout</a></li>
							</ul></li>
					</ul>
				</div>
				<!-- /.navbar-collapse -->
			</nav>
		</div>
	</div>

	<div id="under_header">
		<div class="half left">
			<div id="lside">
				<div class="list-group" align="center">
					<a class="list-group-item active"><b>Admin Site</b></a>
				</div>
			</div>
		</div>
		<div class="half right">
			<ol class="breadcrumb">
				<li>&nbsp;</li>
				<li><b>Inventory</b></li>
			</ol>
		</div>
	</div>

	<div id="content">
		<div class="half left">
			<div id="lside">
				<ul class="nav nav-pills nav-stacked">
					<li class="divider"></li>
					<li><a href="<?php echo base_url();?>inv_ctrl"><span
							class="glyphicon glyphicon-home">&nbsp;&nbsp;</span><b>Home</b></a></li>
					<li class="active"><a
						href="<?php echo base_url();?>inv_ctrl/inventory"><span
							class="glyphicon glyphicon-stats">&nbsp;&nbsp;</span><b>Inventory</b></a></li>
					<li><a href="<?php echo base_url();?>sol_ctrl"><span
							class="glyphicon glyphicon-barcode">&nbsp;&nbsp;</span><b>Sold
								List</b></a></li>
					<li><a href="<?php echo base_url();?>pur_ctrl"><span
							class="glyphicon glyphicon-shopping-cart">&nbsp;&nbsp;</span><b>Purchasing</b></a></li>
					<li><a href="<?php echo base_url();?>exp_ctrl"><span
							class="glyphicon glyphicon-time">&nbsp;&nbsp;</span><b>Expiration
								Check</b></a></li>
					<li><a href="<?php echo base_url();?>acc_ctrl"><span
							class="glyphicon glyphicon-user">&nbsp;&nbsp;</span><b>Account</b></a></li>
					<li></li>
					<li></li>
					<li></li>
				</ul>

			</div>
		</div>

		<div class="half right">

			<feldset>

			<div class="panel panel-primary">
				<div class="panel-heading">
					<h3 class="panel-title">Stock Detail</h3>
				</div>

				<div class="panel-group" id="accordion">
					<div class="panel panel-default">
						<div class="panel-heading">
							<h4 class="panel-title">
								<a data-toggle="collapse" data-parent="#accordion"
									href="#collapseOne"> Add Drug + </a>
							</h4>
						</div>
						<div id="collapseOne" class="panel-collapse collapse">
							<div class="panel-body">

								<form id="form_add_drug" method="post" action="<?php echo base_url();?>inv_ctrl/add_drug">
								
									<div class="row">
										<div class="col-lg-4">
										<label>Drug : </label><input type="text" name="mdc_name" id="mdc_name"
											class="form-control" placeholder="Drug name" required="true">
										</div>
										<div class="col-lg-4">
											<label>Type : </label>
											<select class="form-control" id="mdc_type" name="mdc_type">
											<?php foreach($type as $ty){?>
											<option value="<?php echo $ty['mdctype_id']; ?>">
											<?php echo $ty['mdc_type']; ?></option>
											<?php }?>
										</select>
										</div>
									</div>
									<div class="row">
										<div class="col-lg-2">
											<label>Amount : </label>
											<input type="number" name="mdc_amount" id="mdc_amount"
											class="form-control" placeholder="0" min="1" max="9999" required="true">
										</div>
										<div class="col-lg-2">
											<label>Cost per Unit : </label>
											<input type="number" name="mdc_cost" id="mdc_cost"
											class="form-control" placeholder="0" min="1" max="9999" required="true">
										</div>
										<div class="col-lg-4">
											<label>Date Expire : </label>
											<input type="date" name="mdc_expire" id="mdc_expire" class="form-control" required="true">
										</div>
									</div>
									<div class="row">
										<div class="col-lg-2">
											<label>Price : </label>
											<input type="number" name="price1" id="price1"
											class="form-control" placeholder="TH" min="1" max="9999" required="true">
										</div>
										<div class="col-lg-2">
											<label>&nbsp;</label>
											<input type="number" name="price2" id="price2"
											class="form-control" placeholder="CH" min="1" max="9999" required="true">
										</div>
										<div class="col-lg-2">
											<label>&nbsp;</label>
											<input type="number" name="price3" id="price3"
											class="form-control" placeholder="EU" min="1" max="9999" required="true">
										</div>
										<div class="col-lg-1">
											<label>Confirm:</label>
											<button class="btn btn-primary" type="submit">Add</button>
										</div>
										<div class="col-lg-1">
											<label>&nbsp;</label><button class="btn btn-danger" type="reset">Reset</button>
										</div>
									</div>
								</form>

							</div>
						</div>
						</div>
						</div>
						
					<div class="panel panel-info"> <!-- Default panel contents -->
						<div class="panel-heading">
							<span class="glyphicon glyphicon-shopping-cart"></span> Item list
						</div>
					
					<div class="panel-body">
							
						<table class="table table-hover" width="100%">
							<thead>
								<td align="center"><b>#</b></td>
								<td align="center"><b>Drug</b></td>
								<td align="center"><b>Type</b></td>
								<td align="center"><b>Cost</b></td>
								<td align="center"><b>Amount</b></td>
								<td align="center"><b>price1</b></td>
								<td align="center"><b>price2</b></td>
								<td align="center"><b>price3</b></td>
								<td align="center"><b>Date Input</b></td>
								<td align="center"><b>Date Expire</b></td>
								<td align="center"><b>Customize</b></td>
							</thead>
							<tbody>
							
							<?php for($i=0;$i<count($result);$i++){ ?>
							
							
								<tr>
									<td align="center"> <?php echo $i+1;?></td>
									<td align="center"> <?php echo $result[$i]['mdc_name'];?></td>
									<td align="center"> <?php echo $result[$i]['mdc_type'];?></td>
									<td align="center"> <?php echo $result[$i]['mdc_cost'];?></td>
									<td align="center"> <?php echo $result[$i]['mdc_amount'];?></td>
									<td align="center"> <?php echo $result[$i]['price1'];?></td>
									<td align="center"> <?php echo $result[$i]['price2'];?></td>
									<td align="center"> <?php echo $result[$i]['price3'];?></td>
									<td align="center"> <?php echo $result[$i]['mdc_input'];?></td>
									<td align="center"> <?php echo $result[$i]['mdc_expire'];?></td>
									<td align="center"><a data-toggle="modal" data-target="#myModal">
									<span class="glyphicon glyphicon-pencil"></span></a>&nbsp;
									<a href="<?php echo base_url();?>inv_ctrl/delete/<?php echo $result[$i]['mdc_id'];?>">
									<span class="glyphicon glyphicon-trash"></span></a></td>
											</tr>
							<?php }  ?>

							</tbody>
						</table>
					</div>

				</div>

			</div>
			
			<!-- Modal -->
					<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
							
						<form name="validateaddpeople" id="validateaddpeople" class="validateaddpeople" 
						action="<?php echo base_url();?>acc_ctrl/update_user_data/<?php echo $session_data["usertype_id"]; ?>" method="post">
							
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
									<h4 class="modal-title" id="myModalLabel">Edit Profile</h4>
								</div>
							<div class="modal-body">
									
								<?php $session_data = $this->session->userdata('logged_in');?>
											
									<?php $attr = array (
										'id' => 'form_add_drug',
										'method' => 'post' );
								echo form_open ( 'inv_ctrl/add_drug', $attr ); ?>
									<div class="row">
										<div class="col-lg-4">
										<label>Drug : </label><input type="text" name="mdc_name" id="mdc_name"
											class="form-control" placeholder="Drug name" required="true">
										</div>
										<div class="col-lg-4">
											<label>Type : </label>
											<select class="form-control" id="mdc_type" name="mdc_type">
											<?php foreach($type as $ty){?>
											<option value="<?php echo $ty['mdctype_id']; ?>">
											<?php echo $ty['mdc_type']; ?></option>
											<?php }?>
										</select>
										</div>
										<div class="col-lg-4">
											<label>Date Expire : </label>
											<input type="date" name="mdc_expire" id="mdc_expire" class="form-control" required="true">
										</div>
									</div>
									<div class="row">
										<div class="col-lg-4">
											<label>Amount : </label>
											<input type="number" name="mdc_amount" id="mdc_amount"
											class="form-control" placeholder="0" min="1" max="9999">
										</div>
										<div class="col-lg-4">
											<label>Cost per Unit : </label>
											<input type="number" name="mdc_cost" id="mdc_cost"
											class="form-control" placeholder="0" min="1" max="9999">
										</div>
									</div>
									<div class="row">
										<div class="col-lg-2">
											<label>Price : </label>
											<input type="number" name="price1" id="price1"
											class="form-control" placeholder="TH" min="1" max="9999">
										</div>
										<div class="col-lg-2">
											<label>&nbsp;</label>
											<input type="number" name="price2" id="price2"
											class="form-control" placeholder="CH" min="1" max="9999">
										</div>
										<div class="col-lg-2">
											<label>&nbsp;</label>
											<input type="number" name="price3" id="price3"
											class="form-control" placeholder="EU" min="1" max="9999">
										</div>
									</div>
								<?php form_close(); ?>
									</div>
									<div class="modal-footer">
										<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
										<button type="reset" class="btn btn-default">Reset</button>
										<button type="submit" class="btn btn-primary">Save changes</button>
									</div>
								</div><!-- /.modal-content -->
								</form>
							</div><!-- /.modal-dialog -->
						</div><!-- /.modal -->
			
			</feldset><br/>

			<div class="footer">
				
				<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
			<ul class="nav nav-tabs navbar-right">
				<li><a>Alert</a></li>
			</ul>
			<ul class="nav nav-tabs navber-left">
			
				<li><b><p class="navbar-text">Search&nbsp;&nbsp;<span class="glyphicon glyphicon-search"></span></p></b></li>
				
				<form class="navbar-form navbar-left" role="search" name="keyword" id="keyword" 
				action="<?php echo base_url();?>inv_ctrl/search_keyword" method="post">
        			<div class="form-group">
          				<input type="text" name="keyword" class="form-control" placeholder="Search">
        			</div>
        		<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-send"></span></button>
      			</form>
				
			</ul>
		</nav>
		
			</div>
			
</body>

</html>